package com.rd.student.dashuju.wangbo.exercise0728;

import java.io.File;

public class TestN {

    public static void main(String[] args) {
//        System.out.println(new Scanner(System.in).nextInt());
//        System.out.println(factorial(5));
        File file = new File("src");
        listAll(file);
    }

    public static int factorial(int n) {
        if (n == 1) return 1;
        int A = factorial(n-1);
        return n * A;
    }

    public static void listAll(File file){

        File[] files = file.listFiles();
        if (files == null || files.length == 0) return;
        for (File tmpFile : files){
//            System.out.println(tmpFile.getName());
//            if (tmpFile.isFile()){
//                System.out.println(tmpFile.getName());
//                continue;
//            }
            if (tmpFile.isFile()){
                System.out.println(file.getName() + tmpFile.getName() );
            }
            if (tmpFile.isDirectory()){
                System.out.println( file.getName() + tmpFile.getName());
                listAll(tmpFile);
            }
        }
    }

    //    遍历文件夹
}
